<?php

require_once dirname(__FILE__) . '/TestCase.php';
require_once 'Auth/Vidoop/Secure/CaptchaService.php';

class Auth_Vidoop_Secure_CaptchaParseTest extends Auth_Vidoop_Secure_TestCase {

	public function testResponseParsing() {
		$xml = file_get_contents($this->data_dir . 'captcha_response_1.xml');
		$captcha = Auth_Vidoop_Captcha::from_xml($xml);

		$this->assertEquals(array('food', 'flowers'), $captcha->categories);
		$this->assertEquals('6EEPEA97W2', $captcha->id);
		$this->assertEquals(2, $captcha->captcha_length);
		$this->assertFalse($captcha->order_matters);
		$this->assertEquals(3, $captcha->width);
		$this->assertEquals('Red', $captcha->image_code_color);
		$this->assertEquals('Enter the letters for food, and flowers and click Submit.', $captcha->text);
		$this->assertEquals('https://api.vidoop.com/vs/captchas/6EEPEA97W2/image', $captcha->image);
		$this->assertFalse($captcha->attempted);
		$this->assertFalse($captcha->authenticated);
	}

}
